function maximumPathSumI(a) {
    let n = a.length;
    const dp = Array.from(new Array(n), () => new Array(n).fill(0));//干净实用的二维数组创建方法
    for (let j = 0; j < n; j++) {
        dp[n - 1][j] = a[n - 1][j];
    }
    for (let i = n - 2; i >= 0; i--) {
        for (let j = 0; j <= i; j++) {
            dp[i][j] = Math.max(dp[i + 1][j], dp[i + 1][j + 1]) + a[i][j];
        }
    }
    return dp[0][0];
}

console.assert(23 === maximumPathSumI([[3, 0, 0, 0], [7, 4, 0, 0], [2, 4, 6, 0], [8, 5, 9, 3]]));